package com.exception;

public class Bank {
	double balance;// 存款数
	   Bank(double  balance){this.balance=balance;}
	   public void deposite(double dAmount){
	   	 if(dAmount>0.0) balance+=dAmount;
	   }
	   public void withdrawal(double dAmount)throws  InsufficientFundsExceptionextends{
		   if (balance<dAmount){
			   throw new  InsufficientFundsExceptionextends(this, dAmount);
	   	    }
	         
		   balance=balance-dAmount;
	   }
	   public void showBalance(){
	      System.out.println("The balance is "+(int)balance);
	   }
	   
	   
	   public static void main(String args[]){
		   	 try{
		   	    Bank ba=new Bank(50);
		          ba.withdrawal(100);
		          System.out.println("Withdrawal successful!");
		      }catch(InsufficientFundsExceptionextends e) { 
		          System.out.println(e.toString());
		          System.out.println(e.excepMessage());
		      }
		   }


}
